from django.db import models
from django.contrib.auth.models import AbstractUser, Group, Permission

# Create your models here.
class MyUser(AbstractUser):
    qq = models.CharField('QQ号码',max_length=16)
    weChat = models.CharField('微信账号',max_length=100)
    mobile = models.CharField('手机号码',max_length=11)
    groups = models.ManyToManyField(
        Group,
        related_name='myuser_set',
        blank=True,
        help_text='The groups this user belongs to.',
        verbose_name='groups',
    )
    user_permissions = models.ManyToManyField(
        Permission,
        related_name='myuser_set',
        blank=True,
        help_text='Specific permissions for this user.',
        verbose_name='user permissions',
    )
    #设置返回值
    def __str__(self):
        return self.username

    class Meta:
        permissions = [
            ("can_access_vip", "Can access VIP page"),  # 自定义权限
        ]